package dao

import (
	"doctor_srv/global"
	"doctor_srv/model"
)

func GetPatientByDoctorID(doctorID int32, status int32) ([]model.Patient, error) {
	var Patient []model.Patient
	err := global.DB.Where("doctor_id = ? AND status = ?", doctorID, status).Find(&Patient).Error
	if err != nil {
		return nil, err
	}
	return Patient, nil
}

func GetPatientByDoctorID1(doctorID int32) ([]model.Patient, error) {
	var Patient []model.Patient
	err := global.DB.Where("doctor_id = ?", doctorID).Find(&Patient).Error
	if err != nil {
		return nil, err
	}
	return Patient, nil
}

func GetPatientInfo(patientID int32) []model.Patient {
	var Patient []model.Patient
	global.DB.Where("id = ?", patientID).Preload("Folder").Find(&Patient)
	return Patient
}
